<template>
	<view>
		<view class="top">
			<image src="../../static/dl.png" mode="" style="width: 100%; height: 100%; position: fixed;"></image>
			<view class="tu">
				<image src="../../static/dl1.png" mode="" style="width: 100%; position: absolute;"></image>
				<text style="font-size: 36rpx;  display: block; text-align: center; position: relative;top: 30rpx;">登录</text>
				<input class="inp" type="text" placeholder="请输入手机号" maxlength=11 v-model="mobile"  />
				<button class="btn" @click="denglu(mobile)" >登录</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mobile: '',
			}
		},
    onLoad() {
    this.gg()
   //分享微信好友
   if (this.$wechat && this.$wechat.isWechat()) {
   		this.$wechat.share();
   }
    },
		methods: {
			denglu(mobile) {
				let reg = /^[1][3,4,5,7,8,9][0-9]{9}$/
				if (!this.mobile) { //判断如果手机号为空，提示用户输入手机号
					uni.showToast({
						title: '请输入手机号',
						icon: 'none'
					})
					return
				} else if (!reg.test(this.mobile)) { //判断手机号格式时候正确
					uni.showToast({
						title: '请输入正确的手机号',
						icon: 'none'
					})
					return
				}

				console.log(this.mobile);
				uni.setStorage({
					key: "mobile",
					data: this.mobile,
					success(res) {
						console.log(res)
						uni.switchTab({
							url: '../my/my?mobile='+mobile
						})
					}
				})
     
			},
      
      gg(){
      	let that = this;
      	uni.getStorage({
      		key:'mobile',
      		success(res){
      			// console.log(res.data)
      			that.mobile=res.data;
            console.log(that.mobile)
      		}
      	})
      },
      
      
			// quzhi(){
			// 	uni.getStorage({
			// 		key:'input',
			// 		success(res){
			// 			console.log(res)
			// 		}
			// 	})
			// }
		}
	}
</script>

<style lang="scss">
	.top {
		width: 100%;
		height: 1445rpx;
		background-color: #007AFF;

		.tu {
			width: 705rpx;
			height: 388rpx;


			position: fixed;
			margin: 690rpx 24rpx;
		}
	}

	.inp {
		width: 616rpx;
		height: 68rpx;
		margin: 100rpx 30rpx;
		position: absolute;
		padding-left: 30rpx;
		background-color: #E8E8E8;
	}

	.btn {
		width: 645rpx;
		height: 68rpx;
		background-color: #4575FC;
		margin: 240rpx 30rpx;
		position: absolute;
		padding-left: 30rpx;
		color: #fff;
		line-height: 68rpx;

	}
</style>
